package com.baylor.server.business.common;

import com.baylor.server.business.util.Maps;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public class ResponseObject implements Serializable {
    private boolean success = true;
    private int error;
    private String errorMsg;
    private String command;
    private String requestCode;//请求码
    private String deviceType;//设备类型
    private Object result = new Object();
    private Map<String, Object> info = Maps.newHashMap();

    public void addData(Object obj) {
        result = obj;
    }

    /**
     * @return the success
     */
    public boolean isSuccess() {
        return success;
    }

    /**
     * @param success
     *            the success to set
     */
    public void setSuccess(boolean success) {
        this.success = success;
    }

    /**
     * @return the error
     */
    public int getError() {
        return error;
    }

    /**
     * @param error
     *            the error to set
     */
    public void setError(int error) {
        this.error = error;
    }

    /**
     * @return the errorMsg
     */
    public String getErrorMsg() {
        return errorMsg;
    }

    /**
     * @param errorMsg
     *            the errorMsg to set
     */
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public void setErrMsg(int error, String errorMsg) {
        this.error = error;
        this.errorMsg = errorMsg;
    }

    public String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public Object getData() {
        return result;
    }

    public void setData(List<Object> data) {
        this.result = data;
    }

    // public List<Object> getResultData() {
    // return resultData;
    // }
    //
    // public void setResultData(List<Object> resultData) {
    // this.resultData = resultData;
    // }

    public Map<String, Object> getInfo() {
        return info;
    }

    public void setInfo(Map<String, Object> info) {
        this.info = info;
    }

    public Map<String, Object> addInfo(String key, Object value) {
        info.put(key, value);
        return info;
    }

    /**
     * @return the requestCode
     */
    public String getRequestCode() {
        return requestCode;
    }

    /**
     * @param requestCode
     *            the requestCode to set
     */
    public void setRequestCode(String requestCode) {
        this.requestCode = requestCode;
    }


	public String getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}

	@Override
	public String toString() {
		return "ResponseObject [success=" + success + ", error=" + error
				+ ", errorMsg=" + errorMsg + ", command=" + command
				+ ", requestCode=" + requestCode + ", deviceType=" + deviceType
				+ ", result=" + result + ", info=" + info + ", isSuccess()="
				+ isSuccess() + ", getError()=" + getError()
				+ ", getErrorMsg()=" + getErrorMsg() + ", getCommand()="
				+ getCommand() + ", getData()=" + getData() + ", getInfo()="
				+ getInfo() + ", getRequestCode()=" + getRequestCode()
				+ ", getDeviceType()=" + getDeviceType() + ", getClass()="
				+ getClass() + ", hashCode()=" + hashCode() + ", toString()="
				+ super.toString() + "]";
	}


}
